#ifndef PLAYAREA_H
#define PLAYAREA_H

#include <QList>
#include <QPoint>
#include <QPixmap>
#include <QWidget>

#include "gui/CCardRegion.h"
#include "GameManager.h"
#include "HumanPlayer.h"

//  class QDragMoveEvent;
//  class QDropEvent;
//  class QMouseEvent;

namespace CardGraphics {
  static const char* StackNameStrings[] = {"draw pile","discard pile",
                                           "player's hand","opponent's hand"};
  enum StackNames { DrawPile, DiscardPile, PlayerHand, OppHand, NumStacks };
}
class PlayArea : public QWidget
{
  Q_OBJECT

  public:
    PlayArea(QWidget *parent = 0);
    void reset();
    void startGame(const GameManager* game, const Player** players, int human);

  public slots:
    void revealHands();

  protected:
    void mousePressEvent(QMouseEvent *event);
    void paintEvent(QPaintEvent *event);
    void resizeEvent(QResizeEvent *event);

  signals:
    void drawPileClicked();
    void discardPileClicked();
    void playerHandClicked(int);

  private:
    int targetRegion(const QPoint &position) const;
    void setStackPositions();

    QPixmap deck;
    QList<CCardRegion> cardRegions;
    int selectedRegion;

    int handX, drawX, discardX;
    int oppY, pileY, playerY;
    int handSeparation;
};

#endif // PLAYAREA_H